# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     day103_pyqt5_pushbtn
   Description :
   Author :       fuml
   date：          2019/9/20
-------------------------------------------------
   Change Activity:
                   2019/9/20: close a window
-------------------------------------------------
"""

import sys
from  PyQt5.QtWidgets import (QApplication,QPushButton,QWidget,QToolTip,QMessageBox)
from PyQt5.QtGui import QFont
from PyQt5.QtCore import QCoreApplication
class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.setGeometry(300,300,300,300)
        self.setWindowTitle('test quit button')
        self.show()

    def closeEvent(self, event):
        reply=QMessageBox.question(self,'Message','Are you sure to quit?',QMessageBox.Yes| QMessageBox.No,QMessageBox.No)
        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex=Example()
    sys.exit(app.exec_())






